package com.servlet.book;

import com.enitiy.Book;
import com.service.book.BookServiceImpl;
import com.sun.xml.internal.bind.v2.model.core.ID;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * 创建作者 ：MySunshine
 * 创建时间 2022/10/28 17:02
 * 项目名称 SHUSHAN
 */
@WebServlet("/BookSelectAllBykidToMian")
public class BookSelectAllBykidToMian extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int kid = Integer.parseInt(req.getParameter("kid"));
        System.out.println(kid);
        BookServiceImpl bsi = new BookServiceImpl();
        List<Book> books = bsi.SelectBookByKid(kid);
        if (books!=null){
            System.out.println(" kid "+books);
            System.out.println("查询成功");
            req.getSession().setAttribute("book",books);
            req.getRequestDispatcher("/page/book/bookSelectByKid.jsp").forward(req,resp);
        }
    }
}
